<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>注册页面 </title>

</head>
<script>
    function checkData(){
        var sUerName=document.forms[0].userName.value;
        if(sUerName==""){
            alert("请输入用户名");
            document.forms[0].focus();
            return false;
        }
        return true;
    }
</script>
<body>

<form action="" method="post" onsubmit="checkData()">
    用户名：<input type="text" name="userName"><br>
    密码：<input type="password" name="password"><br>
    性别：<input type="radio" name="sex" value="男" checked>男
        <input type="radio" name="sex" value="女" checked>女<br/>
    出生日期：<select name="birth">
            <option value="0">-请选择-</option>
            <option value="1981" selected>1981</option>
            <option value="1982">1982</option>
            </select>年<br/>
    兴趣：<input name="habit" type="checkbox" value="1">音乐
    <input name="habit" type="checkbox" value="2">动漫
    <input name="habit" type="checkbox" value="3">电影<br/>
    <input type="submit" value="提交">
    <input type="reset" value="取消">

</select>
</form>

</body>
</html>